package org.xbill.DNS;

import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public final class Options
{
  private static Map table;

  static
  {
    try
    {
      refresh();
      return;
    }
    catch (SecurityException localSecurityException)
    {
    }
  }

  public static boolean check(String paramString)
  {
    int i;
    if (table == null)
      i = 0;
    while (true)
    {
      while (true)
      {
        return i;
        if (table.get(paramString.toLowerCase()) == null)
          break;
        i = 1;
      }
      i = 0;
    }
  }

  public static void clear()
  {
    table = null;
  }

  public static int intValue(String paramString)
  {
    int i;
    String str = value(paramString);
    if (str != null);
    try
    {
      int j = Integer.parseInt(str);
      if (j > 0)
      {
        i = j;
        return i;
      }
    }
    catch (NumberFormatException localNumberFormatException)
    {
      i = -1;
    }
  }

  public static void refresh()
  {
    StringTokenizer localStringTokenizer;
    String str1 = System.getProperty("dnsjava.options");
    if (str1 != null)
      localStringTokenizer = new StringTokenizer(str1, ",");
    while (true)
    {
      String str2;
      int i;
      while (true)
      {
        if (!(localStringTokenizer.hasMoreTokens()))
          return;
        str2 = localStringTokenizer.nextToken();
        i = str2.indexOf(61);
        if (i != -1)
          break;
        set(str2);
      }
      set(str2.substring(0, i), str2.substring(i + 1));
    }
  }

  public static void set(String paramString)
  {
    if (table == null)
      table = new HashMap();
    table.put(paramString.toLowerCase(), "true");
  }

  public static void set(String paramString1, String paramString2)
  {
    if (table == null)
      table = new HashMap();
    table.put(paramString1.toLowerCase(), paramString2.toLowerCase());
  }

  public static void unset(String paramString)
  {
    if (table == null);
    while (true)
    {
      return;
      table.remove(paramString.toLowerCase());
    }
  }

  public static String value(String paramString)
  {
    String str;
    if (table == null)
      str = null;
    while (true)
    {
      return str;
      str = (String)table.get(paramString.toLowerCase());
    }
  }
}